#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project : gtmsAutoTestProject 
@File    : customer_api.py
@IDE     : PyCharm 
@Author  : Mario
@Date    : 2022/4/27 10:40 
@Describe:
"""
from APIs.miniProgramApi.base_miniProgram_api import BaseMiniProgramApi


class CustomerApi(BaseMiniProgramApi):
    def __init__(self, brandCode, environment, token):
        super().__init__(brandCode, environment, token)

    def customer_info(self):
        """
        会员相关数据
        :return:
        """
        payload = '{}'
        response = self.http_requests('customer/my', payload)
        return response

    def customer_code(self):
        """
        会员动态码
        :return:
        """
        payload = '{}'
        response = self.http_requests('customer/code', payload)
        return response

    def couponMemberList(self, status='0'):
        """
        会员优惠券列表
        :param status:券状态（0=未使用; 1=已使用; 2=已失效）默认为：0
        :return:
        """
        payload = '{"status":"' + status + '"}'
        response = self.http_requests('coupon/member/list/new', payload)
        return response

    def test_1(self):
        payload = '{"brandCode": "823882", "businessCode": "1", "couponNo": "21165234593255276630"}'
        response = self.http_requests('mall/coupon/dynamic/create', payload)
        return response


if __name__ == '__main__':
    test = CustomerApi('823882', 'sit', 'b5be9b02-2ba3-4852-8749-0e6f9b87c509')
    test.customer_code()
